package com.sky.face.translate;

import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sky.face.translate.util.TransApi;

public class Main {

    public static void main(String[] args) {
        String query = "西甲";
        String res = TransApi.buildParams(query, "auto", "en");
        JSONObject json = JSONObject.parseObject(res);
        if (StrUtil.isBlank(json.getString("error_code"))) {
            JSONArray transResult = JSONObject.parseArray(json.getString("trans_result"));
            System.out.println(transResult.getJSONObject(0).getString("dst"));
        }
    }
}
